<?php
namespace Home\Controller;
use Think\Controller;
class SetupController extends Controller {

	//设置页面
	public function setup()
	{
		$user=$_SESSION['id'];
		//判断用户登录
		// if ($_SESSION['id']!='') { 
			if($user!=''){	
		   		$this->display();
	      	}else{
		   	    echo "<script>
		   	            alert('您未登录!');
		   	            location.href='/Index/index';//客户端跳转
		   	          </script>";

		   } 

	}
	//关于我们
	public function about()
	{
		$this->display();
	}
	// 提交反馈
	public function upfan()
	{	
			if (IS_POST) {
			 $fan=D("Userfan");
			 if ($fan->create()) {
			   	$list=$fan->add();
				   	if ($list) {
				   		    
				   		    echo "<script>
				   		            alert('提交成功');
				   		             location.href='/Member';//客户端跳转
				   		          </script>";
				   	}else{
							die("失败了");
				   	}
			   }else{

			   	$this->error($fan->getError());
			   }  
			   
		}else{
			$this->display();
		}
		
	}
	//忘记密码
	public function forget_pwd()
	{
		$this->display();
	}
	//验证原密码
	public function uppass()
	{
		if (IS_POST) {  
			$pass=I("post.password");
		    $pass=md5($pass);

			$qian=M("Qianbao")->field('zfpassword')->where('uid='.$_SESSION['id'])->find();
			// die;
				if ($qian['zfpassword']==$pass) {
				    echo "<script>
				            location.href='/Member/setPass';//客户端跳转
				          </script>";
				}else{
				    
				    echo "<script>
				            alert('与原密码不一致');
				            location.href='/Setup/uppass';//客户端跳转
				          </script>";
				}
			}else{
		  $this->setup();
		}

	}
		   
	

}